/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef LIB3D_HARD_LIGHT_H
#define LIB3D_HARD_LIGHT_H

#include <lib3d/Math.h>
#include <Converter.h>
#include <Color.h>

namespace liba
{
namespace lib3d
{
namespace hard
{

class Light 
{
public:
	enum Type { POINT, DIRECTIONAL, AMBIENT, SPOT  };
	Type type;

	Color diffuse;
	Color specular;
	Color ambient;

	Vector position;
	Vector direction;

    float intensity;

	float falloff;// Spot
	float theta;  // Spot
	float phi;    // Spot

	float constant_attenuation; // Point, Spot
	float linear_attenuation;   // Point, Spot
	float quadratic_attenuation;// Point, Spot

    Light()
        :   type( AMBIENT ),
	        constant_attenuation( 0 ),
	        linear_attenuation( 0 ),
	        quadratic_attenuation( 0 ),
			position( 0, 0, 0 ),
			direction( 0, 0, 1 ), 
			intensity( 0 ),
			ambient( 0, 0, 0 ),
			diffuse( 0, 0, 0 ),
			specular( 0, 0, 0 ),
			falloff( 0 ),
			theta( 0 ),
			phi( 0 )
	{}
};

} // namespace hard
} // namespace lib3d

namespace converter
{
extern EnumPair<char,lib3d::hard::Light::Type> Lib3DHardLightNames[];

template<>
struct ConverterTraits<char,lib3d::hard::Light::Type>
:	public ConverterTraitsEnumBase<char, lib3d::hard::Light::Type, Lib3DHardLightNames>
{};
template<>
struct ConverterTraitsSelector<lib3d::hard::Light::Type> : public ConverterTraitsSelectorLocalBase<lib3d::hard::Light::Type>
{};

} // namespace converter
} // namespace liba
using namespace liba;

#endif //LIB3D_HARD_LIGHT_H